package com.jinbo.footmessage.utils;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
//import java.net.urlstr;


import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Handler;
import android.os.Message;

import com.jinbo.footmessage.MyApplication;
import com.jinbo.footmessage.NavigationActivity;
//下载图片线程，暂时还未用到。
public class DownPic extends Thread
{

	private Bitmap bitmap;
	private String urlstr;
	private String path;
	//private Handler handler= NavigationActivity.handler;
	//private String id;
	//File des;
	public DownPic(String urlstr,String path)//,int index)
	{
		 this.urlstr=urlstr;
		 this.path=path;
		// this.id=id;
		// des= new File(MyApplication.app.getTmpDir(),id+"head.jpg");
	    
	}
	public Bitmap getBitmap()
	{
		return bitmap;
	}

/*	public boolean isDone()
	{
		return is_done;
	}*/
	@Override
	public void run()
	{
		try
		{
			//Message m = new Message();
			URL url = new URL(urlstr);
			InputStream inStream =url.openStream();
			bitmap=BitmapFactory.decodeStream(inStream);
			inStream.close();
		//	is_done=true;
           // m.what = index;
          //  m.obj=
             //handler.sendMessage(m);
		}
		catch (Exception e)
		{
			e.printStackTrace();
		}
	}
}